﻿using System.Collections.Generic;
using Gumini.JulaDB.DataTypes;
using Gumini.JulaDB.Expressions;

namespace Gumini.JulaDB.Interfaces
{
    public interface IHeading<out C> : IEnumerable<C>
        where C : IColumn
    {
        /// <summary>
        /// Returns the ordinal (index) of a column with a given name.
        /// </summary>
        int GetColumnOrdinal(string columnName);
        
        /// <summary>
        /// True if the column exists.
        /// </summary>
        bool ContainsColumn(string columnName);

        /// <summary>
        /// Total number of columns in the heading.
        /// </summary>
        int NumberOfColumns { get; }

        /// <summary>
        /// Gets a column by name.
        /// </summary>
        C this[string name] { get; }

        /// <summary>
        /// Gets a column by ordinal (index).
        /// </summary>
        C this[int i] { get; }

        Context<DataType> GetTypeContext();
    }
}
